<?php

	/*
		Voodoo Validator
		www.voodoovalidator.com
	*/
	
	/*
		For help: admin@voodoovalidator.com
	*/
	
	/*
		This application was developed originally by 
		Robbie Vasquez - www.robbievasquez.com
		Casey McLaughlin - www.caseymclaughlin.com
	*/
	
	/*
		BIRTHDAY: June 1st, 2009
		LAST MODIFIED: 08/12/210
		BY: Robbie Vasquez
	*/
	
//===========================================================

	// This is the root on the server to the website
	// 'http://examples.com' will not work
	// You need the exact root.
	// For examples, a Linux Ubuntu server would need this:
	// $root = '/var/www/example';
	$root = '';
	
	
	// These two arrays will fill this web page with
	// directories in the root of the website and
	// files in the root of the website.
	$dirs = array();
	$files = array();
	
	
	// Open the root directory
	$parts = opendir($root);
	
	
	// This array sets up whatever directories you want to ignore.
	// For example, if would be a waste of time to validate an 'image' folder
	// and a word document folder.
	// For example: $ignore = array('images', 'docs')
	$ignore = array('images', 'scripts', '.', '..', 'voodoo_scripts', 'voodoo_images');
	
	
	// A while loop to get all directories and files into their respective arrays
	while($content = readdir($parts))
	{
		// If it's not something you want to ignore...
		if(!in_array($content, $ignore))
		{
			// The file type will help decide which array the piece belongs in
			$filetype = filetype($root . '/' . $content);
			
			if($filetype == 'dir')
				$dirs[] = $content;
			else
				$files[] = $content;
		}
	}
	
?>

<html>

<header>

	<title>
		Validator - By Robbie Vasquez - www.robbievasquez.com
	</title>

<!-- 
	validate_start.js sends the files in the root through
	the validating program, validate_w3c_v4.php, and sets up the
	directories to be click and opened.
	
	jQuery is needed to operate everything. This version is using jQuery 1.4
-->

<link rel="stylesheet" href="/voodoo_style/v_style.css" />

<script type="text/javascript" src="/voodoo_scripts/jquery.js"></script>
<script type="text/javascript" src="/voodoo_scripts/validate_start.js"></script>

</header>

<body>

<div id="content">

<h1>Voodoo Validator</h1>

<p>
	<a href="http://www.voodoovalidator.com">www.voodoovalidator.com</a>
</p>

<p>
	The creators:
	<br/>
	<a href="http://www.robbievasquez.com">Robbie Vasquez</a>
	<br/>
	<a href="http://caseymclaughlin.com">Casey McLaughlin</a>
</p>

<p>
	Click the directories to validate files within.
</p>

<p>
	Click the validated files to refresh them. NOTE: May not work in IE.
</p>

<h3>Root</h3>
<ul id="validator_list">

	
	<?php
		// This foreach loop prints all the parts of the directory array
		// so that the script validate_start.js has everything it needs
		// to set up the system at the root.
		// All classes and id's are important.
		// If you want to change them here, they must be changed in validate_start.js
		foreach($dirs as $dir): 
	?>
		<li class="<?php echo $dir; ?>"><h3 class="directory" id="<?php echo $dir; ?>"><span class="fakelink">&raquo; <?php echo $dir; ?></span></h3></li>
	<?php endforeach; ?>
	
	<?php
		// This foreach loop prints all the parts of the files array
		// so that the script validate_start.js has everything it needs
		// to send the files through the validating file, validate_w3c_v4.php
		// All the classes and id's are important.
		// If you want to change them here, they must be changed in validate_start.js
		foreach($files as $file): 
	?>
		<li class="file" id="<?php echo $file; ?>"><?php echo $file; ?><br/><img src="/images/loadbar.gif" alt="loading..." /></li>
	<?php endforeach; ?>

</ul>

</div>

</body>

</html>